<?php
class Account extends AppModel
{
    public $name = 'Account';
    public $primaryKey = '_id';
    //public $useDbConfig = 'zeus_db';

    public function get_account($_db_name, $_usn)
    {
        $this->useDbConfig = $_db_name['user_data'];
        $params = array(
            'conditions' => array(
                '_id' => $_usn
            )
        );
        $data = $this->find('first', $params);
        return $data;
    }
    public function get_account_all($_db_name)
    {
        $this->useDbConfig = $_db_name['user_data'];
        $params = array(
            'order' => array('created' => 'DESC'),
        );
        $data = $this->find('all', $params);
        return $data;
    }

    public function account_del($_db_name, $_usn)
    {
        $this->useDbConfig = $_db_name['user_data'];

        if( !$this->delete($_usn) )
            return false;

        return true;
    }

    public function delect_all($_db_name)
    {
        $this->useDbConfig = $_db_name['user_data'];
        $this->deleteAll(array('_id not' => null));
        return true;
    }
}